package com.example.cms.Appointments;
import java.time.LocalDateTime;
public class Appointment {
    private Integer appointmentId;
    private Integer patientId;
    private String patientName;
    private String patientPhone;
    private Integer scheduleId;
    private String appointmentNo;
    private LocalDateTime appointmentTime;
    private Integer queueNumber;
    private String status;
    private Double feeAmount;
    private Double paidAmount;
    private String paymentStatus;
    private String symptoms;
    private String notes;
    private LocalDateTime createTime;
    private LocalDateTime updateTime;

    // 构造器
    public Appointment() {
        this.createTime = LocalDateTime.now();
        this.updateTime = LocalDateTime.now();
        this.status = "PENDING";
        this.paymentStatus = "UNPAID";
    }

    public Appointment(Integer patientId, Integer scheduleId) {
        this();
        this.patientId = patientId;
        this.scheduleId = scheduleId;
        this.appointmentNo = generateAppointmentNo();
        this.appointmentTime = LocalDateTime.now();
    }

    // Getter 和 Setter 方法
    public Integer getAppointmentId() {
        return appointmentId;
    }

    public void setAppointmentId(Integer appointmentId) {
        this.appointmentId = appointmentId;
    }

    public Integer getPatientId() {
        return patientId;
    }

    public void setPatientId(Integer patientId) {
        this.patientId = patientId;
    }

    public String getPatientName() {
        return patientName;
    }

    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }

    public String getPatientPhone() {
        return patientPhone;
    }

    public void setPatientPhone(String patientPhone) {
        this.patientPhone = patientPhone;
    }

    public Integer getScheduleId() {
        return scheduleId;
    }

    public void setScheduleId(Integer scheduleId) {
        this.scheduleId = scheduleId;
    }

    public String getAppointmentNo() {
        return appointmentNo;
    }

    public void setAppointmentNo(String appointmentNo) {
        this.appointmentNo = appointmentNo;
    }

    public LocalDateTime getAppointmentTime() {
        return appointmentTime;
    }

    public void setAppointmentTime(LocalDateTime appointmentTime) {
        this.appointmentTime = appointmentTime;
    }

    public Integer getQueueNumber() {
        return queueNumber;
    }

    public void setQueueNumber(Integer queueNumber) {
        this.queueNumber = queueNumber;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
        this.updateTime = LocalDateTime.now();
    }

    public Double getFeeAmount() {
        return feeAmount;
    }

    public void setFeeAmount(Double feeAmount) {
        this.feeAmount = feeAmount;
    }

    public Double getPaidAmount() {
        return paidAmount;
    }

    public void setPaidAmount(Double paidAmount) {
        this.paidAmount = paidAmount;
        if (this.paidAmount >= this.feeAmount) {
            this.paymentStatus = "PAID";
        }
    }

    public String getPaymentStatus() {
        return paymentStatus;
    }

    public void setPaymentStatus(String paymentStatus) {
        this.paymentStatus = paymentStatus;
    }

    public String getSymptoms() {
        return symptoms;
    }

    public void setSymptoms(String symptoms) {
        this.symptoms = symptoms;
    }

    public String getNotes() {
        return notes;
    }

    public void setNotes(String notes) {
        this.notes = notes;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    private String generateAppointmentNo() {
        return "APT" + System.currentTimeMillis();
    }

    @Override
    public String toString() {
        return "Appointment{" +
                "appointmentId=" + appointmentId +
                ", appointmentNo='" + appointmentNo + '\'' +
                ", patientName='" + patientName + '\'' +
                ", appointmentTime=" + appointmentTime +
                ", status='" + status + '\'' +
                ", feeAmount=" + feeAmount +
                ", paymentStatus='" + paymentStatus + '\'' +
                '}';
    }
}

